// expiresIn 有效时间(秒)
module.exports = (userinfo) => {
    const jwt = require('jsonwebtoken');
    const { secret } = require('./tokenSecret');
    const token = jwt.sign({
        userName: userinfo.name,
        userId: userinfo.id
    }, secret, {expiresIn: 60*60*24});
    return token;
};